package cn.tedu.test04;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class User {
    /**
     * 自动装配的几种写法
     */
    @Autowired
    @Qualifier("xiaomiPhone")
    private Phone phone;

//    @Autowired
//    private Phone IPhone;

//    @Autowired
//    public void setPhone(@Qualifier(value = "IPhone")Phone phone){
//        this.phone=phone;
//    }

    public void play(){
        System.out.println("玩"+phone.getName());
    }
}
